# -*- coding: utf-8 -*-#
#-------------------------------------------------------------------------------
# 建立者:        潘炎珍  
# Name:         demo06
# Description:
# Author:       98745
# Date:         2019/3/7
#-------------------------------------------------------------------------------

import re
s='a+b+c+'
list=['abc','aabc','bbabc','aabbbcccxyz']
for v in list:
    m=re.match(s,v)
    if m is not None:
        print(m.group())
    else:
        print('{}不匹配{}'.format(v,s))
print('___________________')
s='\d{3}-[a-z]{3}'
list=['123-abc','432-xyz','1234-xyz','1-xyzabc','543-xyz^%ab']
for v in list:
    m=re.match(s,v)
    if m is not None:
        print(m.group())
    else:
        print('{}不匹配{}'.format(v,s))

print('----------------')
s='[a-z]?\d+'
list=['1234','a123','ab432','b234abc']
for v in list:
    m=re.match(s,v)
    if m is not None:
        print(m.group())
    else:
        print('{}不匹配{}'.format(v, s))
print('-----------------')
e='\w+@(\w+\.)*\w+\.com'
elist=['abc@126.com','test@mail.geekori.com','test-abc@geekori.com','abc@geekori.com.cn']
for v in elist:
    m=re.match(e,v)
    if m is not None:
        print(m.group())
    else:
        print('{}不匹配{}'.format(v, e))
st='我的email是lining@geekori.com，请发邮件到这个邮箱'
m=re.search(e,st)
print(m)
e='[a-zA-Z0-9]+@(\w+\.)*\w+\.com'
m=re.search(e,st)
print(m)